﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WaterBill.DAL;
using WaterBill.DTO;
using System.Data;

namespace WaterBill.BUS
{
    class BUS_Customers : DAL_Customers
    {
        DataTable dtC;
        //Lay danh sach tat ca khach hang
        public DataTable BUS_Customers_GetAll()
        {
            dtC = new DataTable();
            try
            {
                dtC = DAL_Customers_GetAll();
            }
            catch
            {
            }
            return dtC;
        }

        //Lay danh sach khach hang co trang thai bang 1
        public DataTable BUS_Customers_GetStatusEnable()
        {
            dtC = new DataTable();
            try
            {
                dtC = DAL_Customers_GetStatusEnable();
            }
            catch
            {
            }
            return dtC;
        }

        //Lay danh sach khach hang chua co hoa don dua vao thang truyen vao
        public DataTable BUS_Customers_GetNotBillOfCharge(int ChargeId)
        {
            dtC = new DataTable();
            try
            {
                dtC = DAL_Customers_GetNotBillOfCharge(ChargeId);
            }
            catch
            {
            }
            return dtC;
        }

        //Them mot khach hang moi
        public Boolean BUS_Customers_Insert(DTO_Customers obj)
        {
            try
            {
                if (DAL_Customers_Insert(obj))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        //Sua khach hang
        public Boolean BUS_Customers_Update(DTO_Customers obj)
        {
            try
            {
                if (DAL_Customers_Update(obj))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        //Xoa khach hang
        public Boolean BUS_Customers_Delete(int CustomerId)
        {
            try
            {
                if (DAL_Customers_Delete(CustomerId))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }
    }
}
